<!DOCTYPE HTML>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="author" content="Bootstrap-ecommerce by Vosidiy">

    <title>订单详情</title>

    <link rel="/shortcut icon" type="image/x-icon" href="/images/favicon.ico">

    <!-- jQuery -->
    <script src="/js/jquery-2.0.0.min.js" type="text/javascript"></script>

    <!-- Bootstrap4 files-->
    <script src="/js/bootstrap.bundle.min.js" type="text/javascript"></script>
    <link href="/css/bootstrap.css" rel="stylesheet" type="text/css"/>

    <!-- Font awesome 5 -->
    <link href="/fonts/fontawesome/css/fontawesome-all.min.css" type="text/css" rel="stylesheet">

    <!-- plugin: fancybox  -->
    <script src="/plugins/fancybox/fancybox.min.js" type="text/javascript"></script>
    <link href="/plugins/fancybox/fancybox.min.css" type="text/css" rel="stylesheet">

    <!-- custom style -->
    <link href="/css/ui.css" rel="stylesheet" type="text/css"/>
    <link href="/css/responsive.css" rel="stylesheet" media="only screen and (max-width: 1200px)" />

    <!-- custom javascript -->
    <script src="/js/script.js" type="text/javascript"></script>

    <script type="text/javascript">
        /// some script

        // jquery ready start
        $(document).ready(function() {
            // jQuery code

        });
        // jquery end
    </script>

</head>
<body>
<header class="section-header">
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <form action="/HTML/userInfo" method="post" name="showUserInfoForm" >
            <a class="navbar-brand" href="javascript:history.go(-1)" name="savesubmit" id="savesubmit"> <img class="logo" src="/images/logo-white.png" th:text="'  '+'订单详情'"></a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar1" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
        </form>

        <div class="collapse navbar-collapse" id="navbar1">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a class="btn ml-2 btn-outline-danger" href="/HTML/relogin">退出登录<span class="sr-only">(current)</span></a>
                </li>
                <li class="new-item">
                    <a class="btn ml-2 btn-outline-success" href="/HTML/home">返回主页</a>
                </li>
                <form action="/HTML/lookOrderList" method="post" name="showUserOrderForm" th:value="${account}">
                    <li class="nav-item">
                        <a class="btn ml-2 btn-outline-primary" href="javascript:showUserOrderForm.submit();">我的订单<span class="sr-only">(current)</span></a>
                    </li>
                </form>
                <li class="nav-item">
                    <a class="btn ml-2 btn-outline-warning" href="javascript:showUserInfoForm.submit();">个人资料</a>
                </li>
            </ul>
        </div>
    </nav>
</header> <!-- section-header.// -->

<form action="/HTML/updateOrderInfo" method="post" name="form1" >
<div class="card">
    <div class="row no-gutters">
        <aside class="col-sm-4 border-right">

            <!--<article class="gallery-wrap">-->
                <!--<div class="img-big-wrap">-->
                    <!--<div> <a href="images/items/1.jpg" data-fancybox=""><img src="images/items/1.jpg"></a></div>-->
                <!--</div> &lt;!&ndash; slider-product.// &ndash;&gt;-->
                <!--<div class="img-small-wrap">-->
                    <!--<div class="item-gallery"> <img src="images/items/1.jpg"></div>-->
                    <!--<div class="item-gallery"> <img src="images/items/2.jpg"></div>-->
                    <!--<div class="item-gallery"> <img src="images/items/3.jpg"></div>-->
                    <!--<div class="item-gallery"> <img src="images/items/4.jpg"></div>-->
                <!--</div> &lt;!&ndash; slider-nav.// &ndash;&gt;-->
            <!--</article> &lt;!&ndash; gallery-wrap .end// &ndash;&gt;-->
        <!--</aside>-->

            <article class="gallery-wrap">
                <div class="img-big-wrap">
                    <div>
                        <img th:src="@{${hotel.photo1}}" id="selectImage">
                    </div>
                </div>
                <hr>
                    <div class="img-small-wrap" >
                        <div class="item-gallery"> <img th:src="@{${hotel.photo1}}" id="selectImage1" onclick="getPhoto(this.id)"></div>
                        <div class="item-gallery"> <img th:src="@{${hotel.photo2}}" id="selectImage2" onclick="getPhoto(this.id)"></div>
                        <div class="item-gallery"> <img th:src="@{${hotel.photo3}}" id="selectImage3" onclick="getPhoto(this.id)"></div>
                        <div class="item-gallery"> <img th:src="@{${hotel.photo4}}" id="selectImage4" onclick="getPhoto(this.id)"></div>
                        <div class="item-gallery"> <img th:src="@{${hotel.photo5}}" id="selectImage5" onclick="getPhoto(this.id)"></div>
                </div> <!-- slider-product.// -->
            </article> <!-- gallery-wrap .end// -->
        </aside>
        <aside class="col-sm-8">
            <article class="p-5">
                <h2 class="title mb-3 text-primary" th:text="${order.hotelName}" id="hotelName"></h2>
                <!--<div class="mb-3">-->
                    <!--<var class="h2 text-warning">-->
                        <!--<span th:text="${order.price}+'￥ /晚'"></span>-->
                    <!--</var>-->
                <!--</div> &lt;!&ndash; price-detail-wrap .// &ndash;&gt;-->
                <hr>
                <div class="row" >
                    <aside class="col-sm-6 border-right">
                        <dl class="row">
                            <dt class="col-sm-4">订单号</dt>
                            <dd class="col-sm-8" th:text="${order.orderId}"> </dd>
                            <input type="hidden"  th:value="${order.orderId}" id="orderId" name="orderId">
                            <dt class="col-sm-4">房号</dt>
                            <dd class="col-sm-8"th:text="${order.roomNumber}" ></dd>
                            <input type="hidden" th:value="${order.roomNumber}" id="roomNumber" name="roomNumber">
                            <dt class="col-sm-4">创建订单的账号</dt>
                            <dd class="col-sm-8"th:text="${order.account}" ></dd>
                            <input type="hidden" th:value="${order.account}" id="account" name="account">
                        </dl>
                    </aside>
                    <aside class="col-sm-6 ">
                        <dl class="row">
                            <dt class="col-sm-3">单日价格</dt>
                            <dd class="col-sm-9 text-warning" id="price" name="price" style="font-weight:bold" th:value="${order.price}" th:text="${order.price}+'￥每夜'"></dd>

                            <dt class="col-sm-3">订单状态</dt>
                            <dd class="col-sm-9" id="orderStatus" name="orderStatus" style="font-weight:bold" th:value="${order.orderStatus}" th:text="${order.orderStatus}"></dd>

                            <dt class="col-sm-3">支付状态</dt>
                            <dd class="col-sm-9" id="paymentStatus" name="paymentStatus" style="font-weight:bold" th:value="${order.paymentStatus}" th:text="${order.paymentStatus}"></dd>
                        </dl>
                    </aside>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"> <i class="fa fa-building"></i>&nbsp;房型</span>
                        </div>
                        <input type="text" class="form-control"  name="roomType"  th:placeholder="${order.roomType}" onkeydown="ableEdit()">
                    </div> <!-- input-group.// -->
                </div> <!-- form-group// -->
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"> <i class="fa fa-clock"></i>&nbsp;入住时间</span>
                        </div>
                        <input type="text" class="form-control"  id ="inTime" name="inTime"  th:placeholder="'必填项:'+${order.inTime}"onkeydown="ableEdit()" >
                    </div> <!-- input-group.// -->
                </div> <!-- form-group// -->
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"> <i class="fa fa-clock"></i>&nbsp;退房时间</span>
                        </div>
                        <input type="text" class="form-control"  id ="outTime" name="outTime"  th:placeholder="'必填项:'+${order.outTime}" onkeydown="ableEdit()">
                    </div> <!-- input-group.// -->
                </div> <!-- form-group// -->
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"> <i class="fa fa-male"></i>&nbsp;入住人数</span>
                        </div>
                        <input type="text" class="form-control"  name="inNumber"  th:placeholder="${order.inNumber}" onkeydown="ableEdit()">
                    </div> <!-- input-group.// -->
                </div> <!-- form-group// -->
                <hr>
                <dl>
                    <dt>描述</dt>
                    <dd>
                        <span>可修改的订单属性有</span>
                        <span class="text-danger">房型</span>
                        <span>、</span>
                        <span class="text-danger">入住时间</span>
                        <span>、</span>
                        <span class="text-danger">退房时间</span>
                        <span>和</span>
                        <span class="text-danger">入住人数</span>
                        <span >。若您要修改订单，请在上方输入框内输入您的修改，点击</span>
                        <span class="text-primary">确认修改</span>
                        <span>即操作完成。输入框内的提示信息为修改前的信息.</span>
                    </dd>
                </dl>
                <!--<a href="#" class="btn  btn-primary">确认修改</a>-->
                <button type="submit" id = "submit" onclick="dateIsNull()" class="btn btn-outline-primary" style="font-size:15px;" th:onclick="return status([[${order.paymentStatus}]],[[${order.orderStatus}]])">确认修改</button>

                <!--<a href="#" class="btn  btn-outline-primary"> <i class="fas fa-shopping-cart"></i> Add to cart </a>-->
            </article> <!-- card-body.// -->
        </aside> <!-- col.// -->
    </div> <!-- row.// -->
</div> <!-- card.// -->
</form>

<!-- ========================= FOOTER ========================= -->
<footer class="section-footer bg-dark white">
    <div class="container">
        <section class="footer-bottom row">
            <div class="col-sm-6">
                <p> 四川大学实训项目 <br>  第六组作品</p>
            </div>
            <div class="col-sm-6">
                <p class="text-sm-right">
                    2019 · 7 · 8 <br>
                    中国 · 成都
                    <!--<a href="http://bootstrap-ecommerce.com">Bootstrap-ecommerce UI kit</a>-->
                </p>
            </div>
        </section> <!-- //footer-top -->
    </div><!-- //container -->
</footer>
<script type="text/javascript" th:inline="javascript">
    function getPhoto(id) {
        document.getElementById("selectImage").src=document.getElementById(id).src;
    }
</script>
<script type="text/javascript">
    function dateIsNull() {
        var inTime =document.getElementById("inTime").value;
        var outTime =document.getElementById("outTime").value;
        if (inTime == "" || inTime == null ){
            document.getElementById("submit").disabled = true;
            alert("入住时间为必填项");
        }
        else  if (outTime == "" || outTime == null ){
            document.getElementById("submit").disabled = true;
            alert("退房时间为必填项");
        }
        else{
        }
    }
    function ableEdit() {
        document.getElementById("submit").disabled = false;
    }
    function status(a,b) {
        if(a!=0||b!=0) {
            document.getElementsById("submit").disabled = true;
            alert("订单已支付，不能修改");
        }
        else {

        }
    }
</script>
</body>
